package com.csx.governance.traffic.adm.model.dto;

import com.csx.governance.traffic.adm.model.bo.ExpressionBO;
import com.csx.governance.traffic.adm.model.pojo.SwimLaneRuleTypeEnum;
import com.csx.governance.traffic.adm.model.pojo.SwimLaneSubStrategy;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author cuisongxu
 * @date 2023/4/23 15:47
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class SwimLaneRouteRuleDTO {

    @Schema(description = "规则名称,唯一标识该规则")
    private String name;

    @Schema(description = "服务名")
    private String serviceName;

    @Schema(description = "泳道规则类型. 有两种类型: ① steady(稳态) ② transition(过渡态)")
    private SwimLaneRuleTypeEnum type;

    @Schema(description = "泳道路由规则列表")
    private List<Rule> rules;

    @Schema(description = "规则是否生效")
    private Boolean enabled;

    @Data
    public static class Rule {

        @Schema(description = "规则匹配表达式")
        private List<ExpressionBO> expression = new ArrayList<>();

        @Schema(description = "规则对应的策略")
        private List<SwimLaneSubStrategy> subStrategies = new ArrayList<>();

        @Schema(description = "是否启用规则")
        private Boolean enabled;

    }

}
